All Questions
4 questions
2votes
1answer
131views
Minimum re-labeling to make an array as close as possible to another one
I have an array with integer labels in [0, n-1], say arr1=[1, 0, 3, 2] with n = 3. And then I have another array again with integer labels in [0, n-1], say arr2=[0, 0, 2, 3]. How can I find the ...
3votes
2answers
2kviews
Maximum sub-array of non-negative numbers
This is the "Maximum sub-array" problem from CodeChef: Find out the maximum sub-array of non negative numbers from an array. The sub-array should be continuous. That is, a sub-array created ...
4votes
3answers
834views
Listing the representations of integer M as a sum of three squares M = x^2 + y^2 + z^2
I am trying a number as the sum of 3 squares. For my particular project I will require a complete list since the next step is to compute nearest neighbors (here). In any case we'd like to find \$ M =...
8votes
2answers
18kviews
Splitting an array of numbers into all possible combinations
This takes an array of numbers then splits it into all possible combinations of the number array of size 4 then in another array puts the leftovers. As I want to take the difference in averages of ...